package cn.iktz.mather.know.web.utils;

import java.math.BigInteger;
import java.security.MessageDigest;

public class Md5Utils {
	public static void main(String[] args) {
		String md5 = getMD5("asdf");
		System.out.println(md5);
	}

	public static String getMD5(String str) {
		try {
			MessageDigest md = MessageDigest.getInstance("MD5");
			md.update(str.getBytes());
			return new BigInteger(1, md.digest()).toString(16);
		} catch (Exception e) {
			e.printStackTrace();
			return str;
		}
	}
}
